# 解决问题
# 1. 打印100行hello world
# 2. 打印1~100
# 3. 计算1+2+3+...+100

# 1.while 语句
# 2.for 语句

# while 判断条件：
#       子语句
# 当条件为真就一直运行子语句

# while 判断条件：
#       循环语句
# else：
#     最后一个不满足循环条件时执行的代码

# 1.打印100行 hello word

# i = 0
# while i<=99:
#     print("hello word")
#     i += 1

# 2.打印1~100

# i = 1
# while i<=100:
#     print(i)
#     i += 1

# 3.计算1+2+3...+100

# sum = 0
# i = 1
# while i<=100:
#     sum += i
#     i += 1
# print(f"1+2+3...+100={sum}")

# else 用法
# i = 1
# while i<=100:
#     print(i)
#     i += 1
# else:
#     print(f"循环结束了 i={i}")

# for 语句
# for 变量 in 数据序列
#     循环语句

# 1.打印100行hello word
# for i in range(1,101):
#     print("hello word")

# for i in range(1,101):
#     print(f"hello word{i}")

# sum = 0
# for i in range(1,101):
#     sum +=i
# print(f"1+2+3...+100={sum}")

# while 语句和 for语句的区别
# for 主要用于固定次数
# while 用于不确定循环次数

# range函数
# range（stop）
# range（start，stop[,step]）

# 0~9
# for i in range(10):
#     print(i)

# # 0 2 4 6 8
# for i in range(0,10,2):
#     print(i)

# 0 -2 -4 -6 -8
# for i in range(0,-10,2):
#     print(i)

# 练习
# 1. 抛出10次骰子，显示每次抛出的数字，计算10次数字的总和             -适合用for语句

# import random
# sum = 0
# for i in range(10):
#     n = random.randint(1,6)
#     print(n)
#     sum += n
# print(f"十次骰子数字总和为：{sum}")

# 2. 抛若干次骰子，显示每次抛出的数字，计算总和,直到总和>50为止        -适合用while语句

# import random
# sum = 0
# times = 0
# while sum<=50:
#     n = random.randint(1,6)
#     print(n)
#     sum += n
#     times += 1
# print(f"停止时投掷骰子的总次数为：{times},骰子总点数为：{sum}")

# 循环的嵌套
# *****
# for i in range(5):
#     print("*",end="")

# *****
# *****
# *****
# *****
# *****
# for i in range(5):
#     for j in range(5):
#         print("*",end="")
#     print()

              # i     # j
# *            0       1
# **           1       2
# ***          2       3
# ****         3       4
# *****        4       5
# for i in range(5):
#     for j in range(i+1):
#         print("*",end="")
#     print()

# 打印99乘法表

# i 第几行
# j 第几列
# for i in range(10):
#     for j in range(10):
#         print(f"{i}*{j}={i*j}",end="\t")
#     print()   #行结束需要换行

# 下三角型99乘法表
# for i in range(10):
#     for j in range(i+1):
#         print(f"{i}*{j}={i*j}",end="\t")
#     print()


# 逆向输出一个数
# n = int(input("请输入一个数字："))
# temp = n
# x = 0
# y = 0
# i = 1
# while temp != 0 :
#     x = temp % 10
#     y = y + x / i
#     temp = temp // 10
#     i = i * 10
# print(y*i/10)

# 找出1-100以内的所有素数
print("1",end=",")
for i in range(2,101):     # 这是遍历2-100
    for j in range(2,i):    # 这是判断是否是素数所需要的材料
        if i%j==0:          # 这是具体判断是否是素数的判断式
            break
        else:
            if j==i-1:
                print(f"{i}", end=",")


